package com.cqut.service.impl;

import com.cqut.VO.topic.TopicDetailsVO;
import com.cqut.VO.topic.TopicListVO;
import com.cqut.entity.Topic;
import com.cqut.mapper.TopicMapper;
import com.cqut.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 冯永龙
 * @since 2021-06-15
 */
@Service
public class TopicServiceImpl implements TopicService {

    @Autowired
    private TopicMapper topicMapper;

    @Override
    public boolean launchTopic(Topic topic) {
        return topicMapper.launchTopic(topic) == 1;
    }

    @Override
    public List<TopicListVO> getTopicList(Integer courseId, Integer userType) {
        return topicMapper.getTopicList(courseId, userType);
    }

    @Override
    public boolean deleteTopic(Integer topicId) {
        return topicMapper.deleteTopic(topicId) == 1;
    }

    @Override
    public TopicDetailsVO getTopicDetails(Integer topicId) {
        return topicMapper.getTopicDetails(topicId);
    }
}
